package com.irdstudio.apicenter.console.service.authenticate;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.irdstudio.apicenter.console.dm.AppDeviceRegister;
import com.irdstudio.apicenter.console.dm.AppDeviceRegisterDao;
import com.irdstudio.apicenter.console.dm.AppTradeLog;

@Service(value = "appDeviceRegisterService")
public class AppDeviceRegisterService {

	@Autowired
	private AppDeviceRegisterDao appDeviceRegisterDao;

	public int insertOne(AppDeviceRegister appDeviceRegister)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.save(appDeviceRegister);
	}

	public AppDeviceRegister queryAppTradePrivate(String appId, String deviceId)
			throws SQLException {
		return appDeviceRegisterDao.queryWithKeys(appId, deviceId);
	}

	public int update(AppDeviceRegister appDeviceRegister) throws SQLException,
			ClassNotFoundException {
		return appDeviceRegisterDao.update(appDeviceRegister);
	}

	public int delete(AppDeviceRegister appDeviceRegister) throws SQLException,
			ClassNotFoundException {
		return appDeviceRegisterDao.delete(appDeviceRegister);
	}
	
	public List<AppDeviceRegister> queryWithByProvince(String appId) throws SQLException{
		return appDeviceRegisterDao.queryWithByProvince(appId);
	}
	
	public int querySumWithBytradeCode(String appId)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.querySumWithBytradeCode(appId);
	}
	
	public List<AppTradeLog> queryWithBytradeCode(String appId)
			throws SQLException {
		return appDeviceRegisterDao.queryWithBytradeCode(appId);
	}
	public List<AppTradeLog> queryWithBytradeCodeOracl(String appId)
			throws SQLException {
		return appDeviceRegisterDao.queryWithBytradeCodeOracl(appId);
	}
	
	public List<AppTradeLog> queryWithByStartTime(String appId, String date)
			throws SQLException {
		return appDeviceRegisterDao.queryWithByStartTime(appId, date);
	}
	public List<AppTradeLog> queryWithByStartTimeOracl(String appId, String date)
			throws SQLException {
		return appDeviceRegisterDao.queryWithByStartTimeOracl(appId, date);
	}
	
	public int querySumWithByStartTime(String appId, String date)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.querySumWithByStartTime(appId, date);
	}
	public int querySumWithByStartTimeOracl(String appId, String date)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.querySumWithByStartTimeOracl(appId, date);
	}
	
	public List<AppDeviceRegister> queryWithByDeviceType(String appId) throws SQLException{
		return appDeviceRegisterDao.queryWithByDeviceType(appId);
	}
	
	public int querySumWithByDeviceType(String appId)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.querySumWithByDeviceType(appId);
	}
	
	public List<AppDeviceRegister> queryWithByDeviceModel(String appId) throws SQLException{
		return appDeviceRegisterDao.queryWithByDeviceModel(appId);
	}
	
	public int querySumWithByDeviceModel(String appId)
			throws SQLException, ClassNotFoundException {
		return appDeviceRegisterDao.querySumWithByDeviceModel(appId);
	}
	
}
